package com.cedric.yixianpai.game.cards.Sects.swordCards.e_HuaShen;

import com.cedric.yixianpai.game.Constants.Period;
import com.cedric.yixianpai.game.Status.DuelStatus;
import com.cedric.yixianpai.game.interfaces.SwordCard;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class FeiLingShanYingJian extends SwordCard {
    /**
     * title:飞灵闪影剑
     * effect:1x4/5/6 每次击伤加1灵气
     */
    public FeiLingShanYingJian(@Value("1") int lvl) {
        super("飞灵闪影剑");
        this.setLevel(lvl);
        this.setPeriod(Period.HUASHEN);
        this.setDescription("1攻x4/5/6 每次击伤加1灵气");

        this.setDamage(1);
        if (1 == lvl) {
            this.setCount(4);
        } else if (2 == lvl) {
            this.setCount(5);
        } else if (3 == lvl) {
            this.setCount(6);
        } else {
            throw new RuntimeException("Card Level Error!");
        }
    }

    @Override
    public boolean effect(DuelStatus Sta1, DuelStatus Sta2) {
        for (int i = 0; i < this.getCount(); i++) {
            if(Sta1.attack(Sta2,this.getDamage())>0){
                Sta1.getPlayerBuff().addSpiritualEnergy(1);
            }
        }
        Sta1.getPlayerBuff().clearSwordIntent();
        return true;
    }
}
